package com.sduept.nwld.dataserver.manager.fault;

import com.sduept.core.dao.SuperDAO;
import com.sduept.nwld.dataserver.model.daily.FaultFeedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class FaultFeedbackManager {
	@Autowired
	private SuperDAO superDao;
	
	public List<FaultFeedback> findFaultFeedback(Date start,Date end){
		List<FaultFeedback> fs = superDao.findByCondition(FaultFeedback.class, 
				" faultTime between ? and ? order by faultTime desc",start,end);
		return fs;
	}
	
	public List<FaultFeedback> find(){
		List<FaultFeedback> f = superDao.findAll(FaultFeedback.class );
		return f;
	}
	
	public void save(FaultFeedback f){
		superDao.createOrUpdate(f, FaultFeedback.class);
	}
	
	public void delete(FaultFeedback f){
		superDao.delete(f.getId(), FaultFeedback.class);
	}
}
